﻿<!-- 继承公共视图文件 -->
<!-- 方法一：-->
<!-- <extend name="./Application/Admin/View/layout.html" /> -->
<!-- 方法二：-->
<extend name="Public:layout" />
<block name="mid">

<div class="row">
	<div class="col-md-6">
		<div class="panel">
			<div class="panel-heading bk-bg-primary">
				<h6><i class="fa fa-indent red"></i>编辑员工信息</h6>
			</div>
			<div class="panel-body">
			<!-- action=""没有值 ，则默认提交到当前路径-->
				<form id="signupForm" action="" method="post" enctype="multipart/form-data" class="form-horizontal ">

					<div class="form-group">
							<label class="col-md-2 control-label" for="file-input">头像</label>
							<div class="input-group col-md-9">
							<!-- 判断头像是否为空 -->
								<notempty name="data['pic']">
									<img width="150" height="150" src="__ROOT__/{$data.pic}"/>
									<a href="{:U('Admin/admin/del_pic/id/'.$data['id'])}"  class="bk-margin-5 btn btn-success">删除</a>
								<else/>
								<input id="file-multiple-input" name="file" multiple type="file">
								</notempty>

							</div>
						</div>
					<div class="form-group">
	                    <label class="col-md-2 control-label" for="text-input">用户名</label>
	                    <div class="input-group">
	                        <input id="adminName" name="name" class="form-control" placeholder="请输入用户名" value="{$data.name}" type="text">
	                        <span class="input-group-addon"><i class="fa fa-user"></i></span>
	                    </div>
	                     <!-- <span class="help-block pull-right">This is a help text</span> -->
	                </div>
	                <div class="form-group">
	                    <label class="col-md-2 control-label" for="email-input">真实姓名</label>
	                    <div class="input-group">
	                        <input id="realName" name="realname" class="form-control" placeholder="请输入真实姓名" value="{$data.realname}" type="text">
	                        <span class="input-group-addon"><i class="fa fa-key"></i></span>
	                    </div>

	                </div>
	                <div class="form-group">
	                    <label class="col-md-2 control-label" for="password-input">邮箱</label>
	                    <div class="input-group">
	                        <input id="adminEmail" value="{$data.email}" name="email" class="form-control" placeholder="请输入邮箱" type="text">
	                        <span class="input-group-addon"><i class="fa fa-envelope-o"></i></span>
	                    </div>
	                </div>
	                <div class="form-group">
	                    <label class="col-md-2 control-label" for="password-input">QQ</label>
	                    <div class="input-group">
	                        <input id="adminQQ" value="{$data.qq}" name="qq" class="form-control" placeholder="请输入QQ" type="text">
	                        <span class="input-group-addon"><i class="fa fa-linux"></i></span>
	                    </div>

	                </div>
	                <div class="form-group">
	                    <label class="col-md-2 control-label" for="password-input">电话</label>
	                    <div class="input-group">
	                        <input id="adminTel" value="{$data.tel}" name="tel" class="form-control" placeholder="请输入电话" type="text">
	                        <span class="input-group-addon"><i class="fa fa-phone"></i></span>
	                    </div>

	                </div>
	                <div class="form-group">
	                    <label class="col-md-2 control-label" for="password-input">地址</label>
	                    <div class="input-group">
	                        <input id="input1-group1" value="{$data.addre}"  name="addre" class="form-control" placeholder="请输入地址" type="text">
	                        <span class="input-group-addon"><i class="fa fa-truck"></i></span>
	                    </div>

	                </div>
					<div class="form-group">
						<label class="col-md-2 control-label" for="select">所属角色</label>
						<div class="col-md-2">
						<!-- 第一种方式：name="group_id"
								第二种方式：group_access[group_id]
						 -->
							<select id="select" name="group_id" class="form-control" size="1">
								<option >请选择角色</option>
								<foreach name="group" item="v">
									<option value="{$v.id}">{$v.title}</option>
								</foreach>
							</select>
						</div>
					</div


						<div class="form-group">
							<label class="col-md-2 control-label">性别</label>
							<div class="col-md-9">
								<div class="radio-custom radio-inline">
									<input id="radio1" name="sex" {$v['sex']?'':'checked'} value="0" type="radio" >
									<label for="radio1">男</label>
								</div>
								<div class="radio-custom radio-inline">
									<input id="radio2" name="sex" {$v['sex']?'':'checked'}  value="1" type="radio">
									<label for="radio2">女</label>
								</div>
							</div>

						</div>


					<button type="submit" class="bk-margin-5 btn btn-success">提交</button>
				</form>
			</div>
		</div>
	</div>
</div>

</block>

<block name="js">
<script src="http://apps.bdimg.com/libs/jquery/2.1.1/jquery.min.js"></script>
<!-- 必须在引入jq文件之前引入 -->
	<script src="__ADMIN__assets/js/jquery.validate.min.js"></script>
	<script type="text/javascript">
		$(function(){
			// 在键盘按下并释放及提交后验证提交表单
			// 抓取验证表单的id
			$("#signupForm").validate({
				// debug:true,//开发的时候阻止表单提交
			    //要验证的规则
			    rules: {
			    	// 'adminName':'required',//必填验证 单个规则写法
			    	//多个验证规则写法：
			    	//用户名校验
			    	'name':{
				    	required: true,
				    	maxlength:10,
	       				minlength: 2,
			    	},
			    	//邮箱校验
			    	'email':{
			    		required: true,
			    		email:true,
			    	},

			    },
			    //错误信息描述
			    messages: {
			    	// adminName:'请输入用户名',
			    	name:{
			    		required: "用户名不能为空",
				        maxlength: "用户名必须不超过10位数",
				        minlength: "用户名必须多于2位数",
			      },
			       email:{
			    		required: "邮箱不能为空",
				        email:"请输入正确的邮箱格式",
			      },
			      // adminSex:{
			    		// required: "请选择性别",
			      // },
			    },
			     errorElement:'span',
			     errorClass:'error',//在layput.html页面定义了提示信息的字体颜色

			})

		})

	</script>
</block>
